(function($){
  $.extend({
    bootModal:function(title,body,size){
      var _this=this;
      var temp=$(`
      <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog ${!!size?'modal-'+size:''}" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" role="remove" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <h4 class="modal-title" id="myModalLabel">${title}</h4>
            </div>
            <div class="modal-body">
              ${body}
            </div>
            <div class="modal-footer">
              <button type="button" role="remove" data-dismiss="modal" class="btn btn-default">取消</button>
              <button type="button" role="submit" class="btn btn-primary">保存</button>
            </div>
          </div>
        </div>
      </div>
      `)
      temp.appendTo('body');
      temp.on('click','[role=submit]',function(){
        temp.trigger('submit',temp)
      })
      temp.on('hidden.bs.modal',function(){
        temp.remove();
      })
      temp.show=function(){
        temp.modal('show')
        return temp;
      }
      temp.hide=function(){
        temp.modal('hide')
        return temp;
      }
      temp.toggle=function(){
        temp.modal('toggle')
        return temp;
      }
      return temp;
    }
  })
})(jQuery)